<?php
class ArticleAction extends HomeAction{
	
	public function _initialize(){
		parent::_initialize();
		$at = D('art_type');
		$child_nav_list = $at->where("state='1' and isnav='1'")->select();
		$this->assign('child_nav_list',$child_nav_list);
	}
	
	public function importart(){
		set_time_limit(0);
		$sqlcontent = file_get_contents('123.sql');
		$sqlarr = explode("|||||",$sqlcontent);
		$rs = D('art');
		$arr = array('—A67手机电影网','—A67手机电视剧','-A67手机电影网','-A67手机电视剧','a67','A67');
		foreach($sqlarr as $val){
			$val = str_replace($arr,array('','','','','',''),$val);
			$rs->execute($val);
		}
	}
	
    //资讯首页
    public function showlist(){
    	$Url = ff_param_url();
		$JumpUrl = ff_param_jump($Url);
		$JumpUrl['p'] = '{!page!}';	
		C('jumpurl',UU('Home-Article/showlist',$JumpUrl,false,true));
		C('currentpage',$Url['page']);
		$List = list_search(F('_ppvod/list'),'list_id='.$Url['id']);
		$channel = $this->Lable_News_List($Url,$List[0]);
		
		//获取资讯列表
		$art_obj = D('art');
		$limit = '30';
		$where = '1 and status=1';
		if(!empty($Url['id']))$where .= " and typeid='$Url[id]'";
		$count = $art_obj->where($where)->count();
		$totalpage = ceil($count/$limit);
		$artarr = $art_obj->where($where)->order('uptime desc')->limit($limit)->page($Url['page'])->select();
		
		$mpurl = C('site_url')."news/list_$Url[id]";
		$multi = multi($count, 30, C('currentpage'), $mpurl);
		$multi = str_replace('list_0_1.html','',$multi);
		$tplarr = array(
			'0'=>array(
				'title'=>'电影电视剧剧情介绍_演员表_娱乐八卦新闻 - '.C('site_name'),
				'keyword'=>'电影剧情介绍,电视剧分集剧情介绍,演员表,娱乐八卦新闻',
				'description'=>C('site_name').'为您提供电影剧情介绍，电视剧分集剧情介绍，演员表，娱乐八卦新闻，请举手之劳推荐给您的朋友。'
			),
			'1'=>array(
				'title'=>'电影资讯_电影上映时间表 - '.C('site_name'),
				'keyword'=>'电影资讯,电影上映时间,电影什么时候上映',
				'description'=>C('site_name').'为您提供电影资讯，电影上映时间，电影什么时候上映，看电影电视剧就上'.C('site_name').'。'
			),
			'3'=>array(
				'title'=>'电视剧资讯_电视剧上映时间表 - '.C('site_name'),
				'keyword'=>'电视剧资讯,电视剧上映时间,电视剧什么时候上映',
				'description'=>C('site_name').'为您提供电视剧资讯，电视剧上映时间，电视剧什么时候上映，看电影电视剧就上'.C('site_name').'。'
			),
			'5'=>array(
				'title'=>'演员表_演员名单 - '.C('site_name'),
				'keyword'=>'演员表,演员名单',
				'description'=>C('site_name').'为您提供电影电视剧演员表，演员名单，看电影电视剧就上'.C('site_name').'。'
			),
			'7'=>array(
				'title'=>'电影剧情介绍_电视剧分集剧情介绍 - '.C('site_name'),
				'keyword'=>'电影剧情介绍,电视剧分集剧情介绍',
				'description'=>C('site_name').'爱看看影视网为您提供电影剧情介绍，电视剧分集剧情介绍，看电影电视剧就上'.C('site_name').'。'
			),
			'9'=>array(
				'title'=>'影评专区 - '.C('site_name'),
				'keyword'=>'影评专区',
				'description'=>C('site_name').'为您提供影视资讯评论，看电影电视剧就上'.C('site_name').'。'
			),
			'11'=>array(
				'title'=>'其他资讯 - '.C('site_name'),
				'keyword'=>'其他资讯',
				'description'=>C('site_name').'为您提供其他资讯，看电影电视剧就上'.C('site_name').'。'
			),
			'13'=>array(
				'title'=>'明星档案_明星资料_明星图片 - '.C('site_name'),
				'keyword'=>'明星档案,明星资料,明星图片',
				'description'=>C('site_name').'为您提供明星档案，明星资料，明星图片，看电影电视剧就上'.C('site_name').'。'
			),
		);
		$this->assign('tplarr',$tplarr[$Url['id']]);
		$this->assign($channel);
		$this->assign('artarr',$artarr);
		$this->assign('cid',$Url['id']);
		$this->assign('multi',$multi);
		$this->assign('list_pid',23);
		$this->assign('list_id','10000');
		$this->assign('site_url',C('site_url'));
    	$this->display('pp_news');
    }
    
    //内容页
    public function content(){
    	$did = $_GET['id'];
    	$tid = $_GET['tid'];
    	if(empty($did))include '404.php';;
    	$art_obj = D('art');
    	$artarr = $art_obj->where("id='$did' and status=1")->find();
    	if(empty($artarr))include '404.php';
    	$contentkeyword = explode(',',$artarr['keyword']); //内容设定的关键字
    	//获取最新资讯 10条
    	$artnewarr = $art_obj->where('status=1')->order('uptime desc')->limit(10)->select();
    	//获取热门资讯
    	$harr = $art_obj->where('status=1')->limit(30)->select();
    	$hotnewkey = array_rand($harr,10);
    	//获取热映电影
    	$hotmovie = ff_mysql_vod('stars:4,5;limit:15;cid:1;order:vod_addtime desc,vod_hits desc');
    	$hotmoviekey = array_rand($hotmovie,5);
    	$tplarr = array(
    		'title' => $artarr['seotitle']?$artarr['seotitle']:$artarr['title'].' - '.C('site_name'),
    		'keyword' => $artarr['seokeyword']?$artarr['seokeyword']:$artarr['keyword'],
    		'description' => $artarr['seodescription']?$artarr['seodescription']:msubstr($artarr['content'],0,100)
    	);
	
    	$this->assign('tplarr',$tplarr);
    	$this->assign('hotmovie',$hotmovie);
    	$this->assign('hotmoviekey',$hotmoviekey);
  		$this->assign('artarr',$artarr);
  		$this->assign('cid',$tid);
  		$this->assign('list_pid',23);
  		$this->assign('list_id','10000');
  		$this->assign('contentkeyword',$contentkeyword);
  		$this->assign('hotnewkey',$hotnewkey);
  		$this->assign('harr',$harr);
  		$this->assign('artnewarr',$artnewarr);
  		$this->assign('site_url',C('site_url'));
  		$this->display('pp_news_content');
    }
}
?>